home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
5 Star Games: DOS Edition 2
/
5 Star Games - DOS Edition (1995)(Ready to Run).iso
/
dbc
/
db_crit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-10
|
2KB
|
89 lines
/****************************************************************************/
/* DATABOSS MODULE: DB_CRIT.C */
/****************************************************************************/
#include "db_lsc.h"
#include <dos.h>
#include "db_types.h"
#include "db_crit.h"
#include "db_dos.h"
/*************************** INTERNAL CONSTANTS ***************************/
#define ABORT 0
#define CONTINUE 1
/*************************** INTERNAL VARIABLES ***************************/
static byte criterrcode = 0;
static word criterrtype = 0;
static word criterrdev = 0;
static bool initialized = False;
/***************************** IMPLEMENTATION *****************************/
void clrcriticalerror(void)
{
criterrcode = 0;
}
byte criticalerror(void)
{
return (criterrcode);
}
#ifdef __TURBOC__
int criterrhandler(int errval, int errtype, int devseg, int devofs)
/* Turbo C manual is inconsistent with the DOS programmer reference
as to the meaning of the registers returned...
Turbo says:- BP:SI points to device header
DOS says:- SI:BP points to device header */
{
wordptr p;
criterrcode = (byte) errval;
criterrtype = errtype;
p = MK_FP(devseg,devofs);
criterrdev = *p;
hardresume(3);
return(ABORT);
}
int ctrlchandler(void)
{
return (CONTINUE);
}
#else
void far criterrhandler(word errtype, word errval, word *devhdr)
{
criterrcode = (byte) (errval);
criterrtype = errtype;
criterrdev = *devhdr;
hardresume(3);
return;
}
void interrupt far ctrlchandler(void){}
#endif
/********************** UNIT INITIALIZATION/EXIT CODE *********************/
void db_crit_init(void)
{
if (!initialized) {
initialized = True;
harderr(criterrhandler);
#ifdef __TURBOC__
ctrlbrk(ctrlchandler);
#else
_dos_setvect(0x1B,ctrlchandler);
_dos_setvect(0x23,ctrlchandler);
#endif
}
}
/**************************** END OF DB_CRIT.C ****************************/